#ifndef _MI5_HH_
#define _MI5_HH_
//
// Military Intellignece Service
// or MI6 who nkows...
//
#include <set>
#include "State.h"
#include "Map.hh"


/// Count reachable enemies according to the rules if one ant of team is at loc
unsigned count_reachable_enemies(Map & map, uLocation sLoc, signed team);

/// Count reachable enemies according to the rules for a given ant position
/// assumes my team if empty position
unsigned count_reachable_enemies(Map & map, uLocation sLoc);

/// evaluates if one of my ants at this position is expected to die
//bool will_die(Map & map, uLocation sLoc);

/// evaluates if one of my ants at this position is expected to die
bool will_die(Map & map, uLocation sLoc, signed team);


/// evaluates if a position is expected to die
/// and count enemies killed (slower)
//bool will_die(Map & map, uLocation sLoc, unsigned & killed);

/// evaluates if a position is expected to die in the worst case
bool may_die(Map & map, uLocation sLoc, signed team);


/// evaluates if a position is expected to die in the worst case
bool may_die(Map & map, uLocation from, uLocation to, signed team);


/// estimate safety level of positions according to neighbourhood
/// rought estimation: only for path-finding
void estimate_rough_safety(Map & map);


// food reserve management
void update_hive_estimate_before_turn(State & state);
void update_hive_estimate_after_turn(State & state);



/// cache known information in case ants in range are lost
struct cache_state_info_t
{
  std::set<uLocation> enemyHills;
  std::set<uLocation> food;
};
void update_map_knowledge(State & state, cache_state_info_t & memory);

#endif /* _MI5_HH_ */
